/* Copyright (C) 2010 Luca Piccinelli
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

/* 
 * File:   formatters.h
 * Author: picci
 *
 * Created on November 27, 2010, 12:12 PM
 */

#ifndef FORMATTERS_H
#define	FORMATTERS_H

#include "prj_definitions.h"
#include "common/utility_data_structures.h"
#include "pipeline/pipeline_io.h"

namespace NAMESPACE{

// ****** Formatter interface definition ***************************************
class Formatter{
public:
    typedef IOElement format_t;

    virtual ~Formatter(){}

    virtual Formatter& format() const = 0;
    virtual Formatter& format(const IOElement& el) const = 0;

    virtual Formatter& set_key(const IOKey& k) = 0;
    virtual const IOKey& get_key() const = 0;

    virtual bool operator==(const Formatter& g) const = 0;
    virtual bool operator!=(const Formatter& g) const = 0;
};
// -----------------------------------------------------------------------------

// ****** AbstractFormatter definition *****************************************
class AbstractFormatter : public Formatter{

private:
    IOKey* key;

public:
    virtual ~AbstractFormatter();
    AbstractFormatter();
    AbstractFormatter(const AbstractFormatter& af);
    AbstractFormatter& operator=(const AbstractFormatter& af);

    AbstractFormatter(const IOKey& k);

    virtual Formatter& format() const = 0;
    virtual Formatter& format(const IOElement& el) const = 0;

    virtual Formatter& set_key(const IOKey& k);
    virtual const IOKey& get_key() const;

    virtual bool operator==(const Formatter& f) const;
    virtual bool operator!=(const Formatter& f) const;
};
// -----------------------------------------------------------------------------

}

#endif	/* FORMATTERS_H */

